package jsp_0810;

import java.io.*;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Servlet implementation class Image
 */
// /Image?no=2
@WebServlet("/Image")
public class Image extends HttpServlet {
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		
		System.out.println(request.getRealPath("/"));
		response.setCharacterEncoding("euc-kr");
		String no = request.getParameter("no");
		String src="";
		if(no==null){ //파라미터가 없을 경우
			src=request.getRealPath("/")+"Img/a.jpg";
		}
		else if(no.equals("1")){
			
		}
		else{
			src=request.getRealPath("/")+"Img/b.jpg";
		}
		PrintWriter pw = response.getWriter();
		pw.write("<img src='"+src+"'>" );
		pw.close();
		
	}

}
